package com.clz.test;

import java.util.Scanner;

public class T4 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入一个字符串");
        String s=sc.nextLine();
        s=removeSpace(s);
        System.out.println("去掉空格后位"+s);

    }
    public static String removeSpace(String s){
       String newS="";
        for (int i = 0; i <s.length(); i++) {
            if ((s.charAt(i)==' ')){
                continue;
            }else {
                newS+=s.charAt(i);
            }
        }
        return  newS;
    }
}
